<link rel="stylesheet" href="ccay/example/demo.css"  type="text/css" />
<script type="text/javascript" src="ccay/example/demo.js" charset="utf-8"></script>
<script type="text/javascript" src="ccay/example/functionDemo/upload/upload.js" ></script>

<div id="uploadDemo">
    <div title='API' tabid='tab1'>
	    <div>
	    	<h2>Ccay.Component.openUploadDialog = function(title, param, width, height);</h2>
	    	<h3>作用：上传控件接口</h3><br>
	    	<form id="param" class="init ccay-form">			
					<div class="ccay-form-body ccay-form-custom">
						<ul>
						<li class="ccay-form-row">
							<samp><h3>参数</h3></samp> 
							<span class="ccay-form-input"><h3>描述</h3></span>
						</li>
						<li class="ccay-form-row">
							<samp class="i18n" i18nKey="title"></samp> 
							<span class="ccay-form-input">
								{String}
								<p> 上传控件对话框标题
							</span>
						</li>
						<li class="ccay-form-row">
							<samp class="i18n" i18nKey="param"></samp> 
							<span class="ccay-form-input">
							        <form class="init ccay-form">
							        <div class="ccay-form-body">
							          <ul>
							          <li class="ccay-form-row">
										 	<samp class="i18n" i18nKey="参数项"></samp>
										 	<span class='ccay-form-input'>说明</span>
										  </li>
							          </ul>
							        </div>
							        <div class="ccay-form-custom">
									  <ul>
										  <li class="ccay-form-row">
										 	<samp class="i18n" i18nKey="uploadType"></samp>
										 	<span class='ccay-form-input'>
										 	     <p>上传类型，上传类为sample 
										 	</span>
										 </li>
										  <li class="ccay-form-row">
										 	<samp class="i18n" i18nKey="callback"></samp>
										 	<span class='ccay-form-input'>
										 	     <p>单个文件上传回调函数
										 	</span>
										 </li>
										  <li class="ccay-form-row">
										 	<samp class="i18n" i18nKey="completeCallback"></samp>
										 	<span class='ccay-form-input'>
										 	     <p>所有文件上传结束的回调函数
										 	</span>
										 </li>
										  <li class="ccay-form-row">
										 	<samp class="i18n" i18nKey="userObject"></samp>
										 	<span class='ccay-form-input'>
										 	     <p>用户对象，上传完可以回传此对象
										 	</span>
										 </li>
										  <li class="ccay-form-row">
										 	<samp class="i18n" i18nKey="needBatchId"></samp>
										 	<span class='ccay-form-input'>
										 	     <p>需要批ID，附件上传时请指定为true
										 	</span>
										 </li>
										  <li class="ccay-form-row">
										 	<samp class="i18n" i18nKey="batchId"></samp>
										 	<span class='ccay-form-input'>
										 	     <p>当前批次ID
										 	</span>
										 </li>
										  <li class="ccay-form-row">
										 	<samp class="i18n" i18nKey="query"></samp>
										 	<span class='ccay-form-input'>
										 	    上传参数，此参数可以在服务器端接收，如：附件功能，设置attType参数由附件处理类接收然后查询数据字典，attType参数值需要配置在App.Attachment节点下，fileTypes（上传文件支持类型如xls,xlsx,doc,docsx,zip,rar），maxSize，maxCount三个节点的Value
										 	</span>
										 </li>
										 <li class="ccay-form-row">
										 	<samp class="i18n" i18nKey="fileType"></samp>
										 	<span class='ccay-form-input'>
										 	  参数值all浏览文件窗口显示"所有文件",参数值非all或不传该参数浏览文件窗口显示"自定义文件" 
										 	</span>
										 </li>
									 </ul>
							       </div>
							       </form>
							</span>
						</li>
						<li class="ccay-form-row">
							<samp class="i18n" i18nKey="width"></samp> 
							<span class="ccay-form-input">
								{Integer}
								<p> 附件控件对话框宽度（默认值，可以自行修改）
							</span>
						</li>
						<li class="ccay-form-row">
							<samp class="i18n" i18nKey="height"></samp> 
							<span class="ccay-form-input">
								{Integer}
								<p> 附件控件对话框高度（默认值，可以自行修改）
							</span>
						</li>
					</ul>
			   </div>
		    </form>  	  
	    	
		    	  
	    </div>
    </div>
    <div title='Demo' tabid='tab2'>
		    	<h4><span>效果展示</span></h4>
		    	<div style="padding-left:30px">
		    	<div id="openTry">
		    	  <div>
 		     <input type="button" class="jbutton" onclick="Ccay.example.functionDemo.upload.openDialog()" value="Open Dialog">
 	       </div> 
		    	</div><br><br>
		    	
		    <h3>HTML CODE</h3>
			<div class='codeArea'>
				<pre id='html'>
&lt;input type="button" class="jbutton" onclick="Ccay.demo.upload.UploadDemo1.openDialog()" value="Open Dialog">
                </pre>
			</div>
			<h3>JS CODE</h3>
			<div class='codeArea'>
				<pre id='js'>				 
Ccay.Module.define("Ccay.demo.upload.UploadDemo1",function(page,$S){ 
	var uploadDemoGrid;
	/**
	 * 单选弹出框页面初始化
	 */
	page.init=function(){};
	/*该语句指定了自动初始化方法（ready），执行的函数，该页面加载之后会主动执行page.init*/
	page.ready=page.init;

	page.openDialog=function(){
		var param={
	    /*上传类型，附件类为sample*/
		uploadType:"sample",
		/*单个文件上传回调函数*/
		callback:demoCallback,
		closeDialog:true,
		/*上传参数，此参数可以在服务器端接收。attType由附件处理类处理，标示附件类型，
		 *附件类型配置在数据字典的App.Attachment节点下，每种类型配置fileTypes（如xls,xlsx,doc,docsx,zip,rar），maxSize，maxCount三个节点的Value
		 */
		query:"a=1&b=2&c=ccay"
		};
		Ccay.Component.openUploadDialog("Upload Demo",param);
	};
	/**
	 *文件上传回调函数	
	 */
	 /*file是文件对象，serverData存储文件名，刪除url etc，batchId是当前批次ID */
	function demoCallback(file,serverData,batchId){ 
		Ccay.Core.log(file);
		Ccay.UI.showMessage("{0} uploaded.".formatValue(file.name));
	} 
});
</pre>
			</div>
			<div class='try'>
				<a onclick="Ccay.example.openTry('#uploadDemo',$('#js').html(),$('#html').html())">亲自试一试</a>
			</div>
			</div>
    </div>
    <div title="试一试" tabid="trytab" >
	    <fieldset class='ccay-demo'>
	    <legend ><h2>代码区</h2></legend>
		   
		   <span>请在下面的文本框中编辑您的代码，然后单击此按钮测试结果  ————></span><input value="try it yourself" type="button" onclick="Ccay.example.runDemo()" /> 

				<div>
				    <table  style="width:100%;">
				      <tr>
				        <td style="width:100%;">
						<h3>js Code:</h3>	
						  <!-- 高度按需来调整。默认最小应为100px -->					
	                      <textarea id="jsTxt" style="height:200px;width:99%;"></textarea>
	                    </td>   
	                  </tr>
	                  <tr>
	                    <td style="width:100%;">
						<h3>html Code:</h3>
						  <!-- 高度按需来调整。默认最小应为100px -->
	                      <textarea id="htmlTxt" style="height:100px;width:99%;"></textarea>
	                    </td>
	                  </tr> 
                    </table>
				</div>
           </fieldset>
        <fieldset class='ccay-demo'>
          <legend ><h2>结果区</h2></legend>
			<div>
				<div style="overflow:auto;" id="demoMainPanel"></div>
			</div>
        </fieldset>
     </div>
	 <div title="FAQ">
		  <form class="init ccay-form">
		    <div class="ccay-form-body">
		    <ul>
		    	<li class="ccay-form-row">
			      <samp><h3>问题</h3></samp>
			      <span class="ccay-form-input">
			               <h3>解决方案</h3>
			      </span>
			    </li>
		    </ul>
			</div>     
			<div class="ccay-form-custom">
			    <ul>                     
			        <!-- 若问题和内容较多，可在li中的class加上ccay-form-whole -->
			        <li class="ccay-form-row">
			                          <samp class="i18n" i18nKey=""></samp>                          
			                         <span class="ccay-form-input"></span>
			        </li>  
			    </ul>
			</div>
		  </form>                    
    </div> 	 
</div>